package com.panopset.game.blackjack;

/**
 * For the droid game, we're only interested in displaying the number of hands
 * since the last mistake, to save screen real-estate.
 * @author Karl Dinwiddie
 *
 */
public class Goofy {
    private int mistakeCount = 0;
    private int handCount = 0;
    private int handsSinceLastMistake = 0;
    private int handsSinceLastMistakeRecord = 0;
    private boolean eligible = true;
    public void reset() {
        mistakeCount = 0;
        handCount = 0;
        setHandsSinceLastMistake(0);
        eligible = true;
    }
    public void rat() {
        mistakeCount++;
        setHandsSinceLastMistake(0);
        eligible = true;
    }
    public int getMistakeCount() {
        return mistakeCount;
    }
    public int getHandsSinceLastMistake() {
        return handsSinceLastMistake;
    }
    public void setHandsSinceLastMistake(final int value) {
        handsSinceLastMistake = value;
        if (value == 0) {
            eligible = true;
        }
    }
    public void setHandsSinceLastMistakeRecord(final int value) {
        if (!eligible) {
            return;
        }
        if (handsSinceLastMistakeRecord < value) {
            handsSinceLastMistakeRecord = value;
        }
    }
    public int getHandsSinceLastMistakeRecord() {
        return handsSinceLastMistakeRecord;
    }
    public int getHandCount() {
        return handCount;
    }
    public void reportNewHand() {
        handCount++;
        handsSinceLastMistake++;
           setHandsSinceLastMistakeRecord(handsSinceLastMistake);
    }
    public void reportNewHandAutomatic() {
        eligible = false;
        reportNewHand();
    }
}
